/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codeGenModel.events;

import codeGenModel.Triad;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Dusty
 */
public class TriadEventListenerManager {
    
    private List<TriadEventListener> listeners = new ArrayList<TriadEventListener>();
    
    public TriadEventListenerManager() {
        
    }
    
    public void addTriadEventListener(TriadEventListener l) {
        listeners.add(l);
    }
    
    public void removeTriadEventListener(TriadEventListener l) {
        listeners.remove(l);
    }
    
    public void fireNewTriad(Triad newTriad) {
        TriadEvent triadEvent = new TriadEvent(newTriad);
        
        for (TriadEventListener listener : listeners) {
            listener.newTriad(triadEvent);
        }
    }
    
    public void fireInitFile() {
        TriadEvent triadEvent = new TriadEvent();
        
        for (TriadEventListener listener : listeners) {
            listener.initFile(triadEvent);
        }
    }
    
    public void fireInitData() {
        TriadEvent triadEvent = new TriadEvent();
        
        for (TriadEventListener listener : listeners) {
            listener.initData(triadEvent);
        }
    }
    
    public void fireEndData() {
        TriadEvent triadEvent = new TriadEvent();
        
        for (TriadEventListener listener : listeners) {
            listener.endData(triadEvent);
        }
    }
    
    public void fireInitCode() {
        TriadEvent triadEvent = new TriadEvent();
        
        for (TriadEventListener listener : listeners) {
            listener.initCode(triadEvent);
        }
    }
    
    public void fireEndCode() {
        TriadEvent triadEvent = new TriadEvent();
        
        for (TriadEventListener listener : listeners) {
            listener.endCode(triadEvent);
        }
    }
    
}
